package com.fubt.repeat.token.impl;

import java.util.concurrent.ConcurrentHashMap;

import com.fubt.repeat.token.TokenManager;

/**
 * 存放在内存中，需要实现移除算法
 * 
 * @author jonathan 2018年3月31日 下午6:25:29
 * @since 1.0.0
 */
public class JvmTokenManager implements TokenManager {

    private ConcurrentHashMap<String, String> tokenBucket = new ConcurrentHashMap<String, String>();

    public void add(String key, String value) {

        tokenBucket.put(key, value);

    }

    public void add(String key, String value, int expire) {

        throw new UnsupportedOperationException();

    }

    public void remove(String key) {

        tokenBucket.remove(key);

    }

    public String get(String key) {
        return tokenBucket.get(key);
    }

}
